package com.xiyu.service.repository.market.setting;

import com.xiyu.service.model.market.setting.MarketSettingDomain;
import com.xiyu.service.model.market.setting.MarketSettingDomainTable;
import com.xiyu.service.vo.market.marketSetting.MarketSettingDomainListInput;
import org.babyfish.jimmer.spring.repository.JRepository;

import java.util.Optional;
import java.util.List;

public interface MarketSettingDomainRepository extends JRepository<MarketSettingDomain, Long> {
    MarketSettingDomainTable marketSettingDomainTable = MarketSettingDomainTable.$;

    default List<MarketSettingDomain> listQuery(MarketSettingDomainListInput inputVO){
        return sql().createQuery(marketSettingDomainTable)
                .where(marketSettingDomainTable.domainName().likeIf(inputVO.getDomainName()))
                .orderBy(marketSettingDomainTable.id().desc())
                .select(marketSettingDomainTable)
                .execute();
    }

    Optional<MarketSettingDomain> findByDomainName(String domainName);

    Optional<MarketSettingDomain> findByApiUser(String apiUser);


}